//
// Created by laichao on 2022/6/4.
//
#include <iostream>
#include <cstring>
#include <algorithm>
#include <set>
#include <vector>
#include <string>

using namespace std;

const int N = 1010;

class Solution {
public:
    int numUniqueEmails(vector<string> &emails) {
        set<string> diffEMail;
        for (int i = 0; i < emails.size(); i++) {
            string addrName, Name;
            int pAT = emails[i].find('@');
            addrName = emails[i].substr(pAT);
            int pos = 0;
            string preStr;
            while (pos < emails[i].size() && emails[i][pos] != '@') {
                if (emails[i][pos] == '.') {
                    pos++;
                    continue;
                } else if (emails[i][pos] == '+') {
                    break;
                } else {
                    preStr += emails[i][pos];
                    pos++;
                }
            }
            Name = (preStr + addrName);
            diffEMail.insert(Name);
        }
        return diffEMail.size();
    }

    int findRepeatNumber(vector<int> &nums) {
        for (const auto &i: nums) {
            if (i < 0 || i >= nums.size()) return -1;
        }
        for (int i = 0; i < nums.size(); ++i) {
            while (i != nums[i] && nums[nums[i]] != nums[i]) swap(nums[i], nums[nums[i]]);
            if (nums[i] != i && nums[nums[i]] == nums[i]) return nums[i];
        }
        return -1;
    }
};

int main() {
    Solution sol;

    return 0;
}